package com.xsx.response;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Response1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("response2's result!");
        //设置响应状态码302 表示重定向 已搬迁
//        resp.setStatus(302);
//        resp.setHeader("Location", "http://localhost:8088/02_Servlet/response2");

        //方法二
        resp.sendRedirect("http://localhost:8088/02_Servlet/response2");
    }
}
